

jQuery(function ($) {
    //搜索栏点击切换内容
    $('.drop').mouseenter(function () {
        $('#list').css('display', 'block');
    }).mouseleave(function () {
        $('#list').css('display', 'none');
    });
    $('#list').on('click', 'li', function () {
        $('#search_class').html($(this).html());
        $('#list').css('display', 'none');
    });
    //点击搜索跳转搜索页
    $('#search_btn').click(function () {
        var keyword = $('#search').val();
        var keyword_p = $('#search').attr('placeholder');
        if (keyword == "") {
            keyword = keyword_p;
        }
        if(!keyword){
            return;
        }
        if ($('.drop #search_class').html() == '采购') {
            window.location.href = '/goods/pur_search.html?keyword=' + keyword;
        } else if ($('.drop #search_class').html() == '供应'||$('.drop #search_class').html() == '商品') {
            window.location.href = '/goods/goods_search.html?keyword=' + keyword;
        } else if ($('.drop #search_class').html() == '资讯') {
            window.location.href = '/article/article_search.html?keyword=' + keyword;
        }
    });
});